﻿Public Class ctrlDGVNhanVien
    Event ChonNhanVien(nhanVien As tbNhanVien)
    Private Sub dgvNhanVien_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvNhanVien.CellDoubleClick
        If bsNhanVien.Current IsNot Nothing Then
            RaiseEvent ChonNhanVien(bsNhanVien.Current)
        End If
    End Sub

    Private Sub dgvNhanVien_CellValueNeeded(sender As Object, e As DataGridViewCellValueEventArgs) Handles dgvNhanVien.CellValueNeeded
        If e.RowIndex >= 0 AndAlso e.ColumnIndex = Me.STT.Index Then
            e.Value = e.RowIndex + 1
        End If
    End Sub

    Event NhanVienThayDoi(nhanVien As tbNhanVien)
    Private Sub bsNhanVien_CurrentChanged(sender As Object, e As EventArgs) Handles bsNhanVien.CurrentChanged
        If bsNhanVien.Current IsNot Nothing Then
            RaiseEvent NhanVienThayDoi(bsNhanVien.Current)
        End If
    End Sub

    Private Sub bsNhanVien_ListChanged(sender As Object, e As System.ComponentModel.ListChangedEventArgs) Handles bsNhanVien.ListChanged
        lblSoDong.Text = bsNhanVien.Count.ToString + " nhân viên."
    End Sub

    Event ThemNhanVien()
    Private Sub ThêmCửaHàngToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ThêmCửaHàngToolStripMenuItem.Click
        RaiseEvent ThemNhanVien()
    End Sub

    Event SuaNhanVien()
    Private Sub SửaCửaHàngToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SửaCửaHàngToolStripMenuItem.Click
        RaiseEvent SuaNhanVien()
    End Sub

    Event XoaNhanVien()
    Private Sub XoáCửaHàngToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles XoáCửaHàngToolStripMenuItem.Click
        RaiseEvent XoaNhanVien()
    End Sub

    Private Sub InDanhSáchToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InDanhSáchToolStripMenuItem.Click
        btnIn_Click(Nothing, Nothing)
    End Sub

    Private Sub btnIn_Click(sender As Object, e As EventArgs) Handles btnIn.Click
        If bsNhanVien.Count > 0 Then

        End If
    End Sub
End Class
